using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Collections;
using System.Collections.Generic;
using System.Web.Mvc;

namespace Kunlun.Models
{
    [Table("Address")]
    [Bind(Exclude = "AddressID")]
    public class Address
    {

        [ScaffoldColumn(false)]
        public int AddressID { get; set; }

        [DisplayName("客户ID")]
        public int Uid { get; set; }

        [DisplayName("省份ID")]
        [Required(ErrorMessage = "省份ID不能空")]
        public int Pid { get; set; }

        [DisplayName("城市ID")]
        [Required(ErrorMessage = "城市ID不能空")]
        public int Cid { get; set; }

        [DisplayName("区域ID")]
        [Required(ErrorMessage = "区域ID不能空")]
        public int Areas { get; set; }

        [DisplayName("联系人")]
        [MaxLength(25)]
        [Required(ErrorMessage = "联系人不能为空")]
        public string LinkMan { get; set; }

        [DisplayName("详细地址")]
        [MaxLength(100)]
        [Required(ErrorMessage = "详细地址不能为空")]
        public string AddressPlace { get; set; }

        [Required]
        [DisplayName("固定电话")]
        [MaxLength(20, ErrorMessage = "不能大于20个字符")]
        public string Phone { get; set; }

        [Required]
        [DisplayName("移动手机")]
        [MaxLength(20, ErrorMessage = "不能大于20个字符")]
        public string Mobile { get; set; }

        [DisplayName("电子邮件")]
        [RegularExpression(@"^[\w\-\.]+@[\w\-\.]+(\.\w+)+$", ErrorMessage = "邮箱输入有误")]
        public string Email { get; set; }

        [DisplayName("邮编")]
        [RegularExpression(@"(\d+){6}", ErrorMessage = "邮编错误")]
        public string Post { get; set; }

        [DisplayName("配送时间(例:周一~周五配送/周一~周日配)")]
        public string DeliveTime { get; set; }

        [Required(ErrorMessage = "创建时间不能空")]
        [DisplayName("创建时间")]
        public DateTime BeginDate { get; set; }

        [DisplayName("最后修改时间")]
        public DateTime LastUpdateTime { get; set; }



        [ForeignKey("Pid")]
        public virtual Provice Provice { get; set; }

        [ForeignKey("Areas")]
        public virtual Area Area { get; set; }

        [ForeignKey("Cid")]
        public virtual City City { get; set; }

        [ForeignKey("Uid")]
        public virtual Consumer Consumer { get; set; }
    }
}
